<?php 

$dirname = "../phpfolder";

function fordir($dirname){
	//打开文件
	$dir = opendir($dirname);
	//读取文件
	readdir($dir);

	while ($file = readdir($dir)) {
		$nfile = $dirname.'/'.$file;
		if(is_dir($nfile)){
			echo "目录：{$nfile} <br>";
		}else{
			echo "文件：{$nfile} <br>";
		}
	}
	//关闭文件
	closedir($dir);
}

fordir($dirname);




 ?>